<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = '7star16';	//語言檔參數，務必放在最前面
$intLID = empty($_data["LottoID"])?4:(int)$_data["LottoID"];
$intSid = $_data[sid];

include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/todaygame/Gamble". $intLID .".inc.php");
include_once(__Common_Path."/gambletype/GambleType".$_SESSION[Member_Info] -> GambleType."_".$intLID.".inc.php");

//取得 TodayGame 資料 BetType = 16, 17
include_once(__Common_Path."/todaygame/TodayGame". $intLID ."_16.inc.php");
include_once(__Common_Path."/todaygame/TodayGame". $intLID ."_17.inc.php");

include_once(__Common_Path."/CommToOddsRate_".$intLID.".inc.php");
$arrUserOPlus = $_SESSION["Member_Info"] -> UserCommToOdds[$intLID];

$isStop = false;
if (!is_array($_arrTodayGame) || !is_array($_arrGamble)) {
	$isStop = true;
} else {
	list($intGID, $arrGData) = each($_arrGamble);

	//判斷是否有 Game 時間是否過期
	$GameEndDateTime	= $arrGData["GameDate"] .' '. $arrGData["EndGameTime"];
	$NowDateTime		= date("Y-m-d") .' '. date("H:i:s");

	if ($NowDateTime > $GameEndDateTime) {
		$isStop = true;
	} else {
		$isStop = false;
	}
}

$fp = @file(__Membertemplate_Path."/7star16.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{LottoID}", $intLID, $fp);
$fp = str_replace("{SerialNo}", ($isStop)?"0":$arrGData["SerialNo"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGData["GameDate"], $fp);
$fp = str_replace("{ShowGameTime}", $arrGData["GameTime"], $fp);

$strCloseClass = "style=\"background-color: #CCCCCC\"";
$arrColor = array(0 => "#FF0000", 1 => "#333399", 2 => "#339900");


$arrNum = array(0, 1, 10, 11, 20, 21, 30, 31, 40, 41, 50, 51);
for($intBT = 16; $intBT <= 17; $intBT++){

	foreach($arrNum as $intNum){

		if($_arrTodayGame[$intGID][$intBT][$intNum]["isStopBet"] || $isStop){
			$fp = str_replace("{Odds".$intBT."_".$intNum."}", $_str7Star16["isStopBet"], $fp);
			$fp = preg_replace("/AC".$intBT."_".$intNum."_S.+AC".$intBT."_".$intNum."_E/s", $strCloseClass, $fp);
		}else{

			$intApointNum = $_arrGLineNumToApointNum[$intLID][$intBT][$intNum];
			if($intApointNum == null)$intApointNum = 0;
			$flOddsPlus = $arrUserOPlus[$intBT][$intApointNum][11] * $_arrChRate[$intBT][$intApointNum][$_SESSION["Member_Info"] -> GambleType+10];

			$strLink = '<a target="leftFrame" href="./wager_common.php?UserID='. $_SESSION["Member_Info"] -> ID .'&GambleID='. $intGID .'&Bet_Type='.$intBT.'&OddsID='. $_arrTodayGame[$intGID][$intBT][$intNum]["OddsID"] .'&Odds='. ($_arrTodayGame[$intGID][$intBT][$intNum]["Odds"]+$_arrGambleType[$intBT][$intApointNum]) .'&LottoID='. $intLID .'&Number='. $intNum .'&sid='.$intSid.'">'. ($_arrTodayGame[$intGID][$intBT][$intNum]["Odds"]+$_arrGambleType[$intBT][$intApointNum] + 1 + $flOddsPlus) .'</a>';
			$fp = str_replace("{Odds".$intBT."_".$intNum."}", $strLink, $fp);
		}
	} //foreach($arrNum as $intNum){
} //for($intBT = 16; $intBT <= 17; $intBT++){

//以下位置不可上下移動
while(list($k, $v) = each($_str7Star16)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>